package com.stark.lab.covid19statistics.dto;

import lombok.Data;

@Data
public class Result {

    int errcode;
    String errmsg;
    Object data;

    public static Result success(Object data){
        Result result = new Result();
        result.setData(data);
        result.setErrcode(0);
        result.setErrmsg("OK");
        return result;
    }

    public static Result success(){
        return success(null);
    }

    public static Result error(String errmsg){
        Result result = new Result();
        result.setErrcode(1);
        result.setErrmsg(errmsg);
        return result;
    }
}
